package com.xzx.shop_front_api.controller;

import com.xzx.shop_front_api.entity.Banner;
import com.xzx.shop_front_api.service.BannerService;
import com.xzx.shop_front_api.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("api/banners")
public class BannerController {
    @Autowired
    private BannerService bannerService;

    @GetMapping("list")
    public JsonResult list(@RequestParam(value = "size",defaultValue = "5") int size) {
        List<Banner> bannerList = bannerService.bannerList(size);
        return JsonResult.success("ok", bannerList);
    }
}
